//
//  MBApp.m
//  mengbutou
//
//  Created by Jiafei Wei on 16/6/30.
//  Copyright © 2016年 Jiafei Wei. All rights reserved.
//

#import "MBTApp.h"
#import "GuideVC.h"
#import "LoginVC.h"
#import "MBTUiColor.h"
#import "MBTPre.h"
#import "SweepCodeBinding.h"
#import "BindVC.h"
#import "NetTools.h"
#import "BindNoInternet.h"
@implementation MBTApp
static MBTApp *instance;
//单例模式
+(MBTApp *)shareAppcation{
    @synchronized (self) {
        instance = [[MBTApp alloc]init];
    }
    return instance;
}
-(UIViewController *)rooTVC{
    UIViewController *vc =nil;
    if (![kFirstLaunch) {
        kSetFirstLaunch;
        //引导页面
        //vc =[[GuideVC alloc]init];
    }else{
        //vc =[[LoginVC alloc]init];
        //vc =[[GuideVC alloc]init];
    }
    //vc =[[LoginVC alloc]init];
//          if([NetTools share].isHaveInternet){
//              vc =[[BindVC alloc]init];
//          }else{
//             vc=[[BindNoInternet alloc]init];
//          }
           vc =[[BindVC alloc]init];
    return vc;
}
-(void)setAppcation{//设置样式
    [self navigationStyle];
    [self tabbarItemStyle];

}
          -(void)navigationStyle{
          UIApplication* application = [UIApplication sharedApplication];
          if (IS_IOS7())
          {
               UINavigationBar *navBar = [UINavigationBar appearance];
              [navBar setBarTintColor:[UIColor mbtRedColorForStateNormal]];
              [navBar setTintColor:[UIColor whiteColor]];
              [navBar setTintColor:[UIColor whiteColor]];
              [navBar setBarTintColor:[UIColor yellowColor]];
              [navBar setBackgroundImage:[UIImage imageNamed:@"nar_bg"] forBarMetrics:UIBarMetricsDefault];
              [application setStatusBarStyle:UIStatusBarStyleLightContent];
            }
      }
 -(void)tabbarItemStyle{
          [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor grayColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
          [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorwithHexString:@"#3366CC"],NSForegroundColorAttributeName, nil]forState:UIControlStateSelected];
}
+(void)keepPassword:(NSString *)key withValue:(NSString *)value{
    kSetAccount(value);
    kSetPassword(value);
              NSUserDefaults *userDefualts=[NSUserDefaults standardUserDefaults];
              [userDefualts setObject:value forKey:key];
              [userDefualts synchronize];
}
@end
